module.exports = function(grunt) {

  var sassStyle = 'expanded';

  grunt.initConfig({
       pkg: grunt.file.readJSON('package.json'),
       stylus:{
            build: {
                files: [{
                    'temporary/index.css': ['src/index.styl']
                }]
            }
       },
       cssmin:{
            css:{
                src:'temporary/index.css',
                dest:'min/index-min.css'
            }
       },
       htmlmin:{
          dist: {                                      // Target 
                options: {                                 // Target options 
                  removeComments: true,
                  collapseWhitespace: true
                },
                files: {                                   // Dictionary of files 
                  './index.html': './other.html',     // 'destination': 'source' 
                }
          },
          dev: {                                       // Another target 
               files: {
                 './index.html': './other.html'
               }
          }
       },
       concat: {
            dist: {
              src: ['./js/*.js'],
              dest: 'temporary/global.js',
            },
       },
       uglify: {
         compressjs: {
           files: {
             'min/global.min.js': ['temporary/global.js']
           }
         }
       },
       watch: {
        scripts: {
                files: ['./js/*.js'],
                tasks: ['concat','uglify']
        },
        another: {
                files: ['src/*.styl'],
                tasks: ['stylus','cssmin']
        },
        livereload: {
            options: {
                livereload: '<%= connect.options.livereload %>'
            },
            files: [
                'index.html',
                'min/global.min.js',
                'min/index-min.css'
            ]
        }
    },
    connect: {
        options: {
            port: 9000,
            open: true,
            livereload: 35729,
            // Change this to '0.0.0.0' to access the server from outside
            hostname: 'localhost'
        },
        server: {
          options: {
            port: 9001,
            base: './'
          }
        }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-stylus');
  grunt.loadNpmTasks('grunt-contrib-cssmin');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-htmlmin');
  grunt.registerTask('change',['stylus','cssmin','concat','uglify','connect','watch']);
  grunt.registerTask('html',['htmlmin']);

};